package mspbots.cw.business.core.contacts;

import org.springframework.data.r2dbc.repository.R2dbcRepository;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

/**
 * @author Jay.Yang
 */
public interface ContactsRepository extends R2dbcRepository<Contacts, Long> {

    /**
     * find entity other id and tenant id
     *
     * @param contactsId contactsId
     * @param tenantCode tenantCode
     * @return account entity
     */
    Mono<Contacts> findByContactsIdAndTenantCode(Long contactsId, Long tenantCode);

    /**
     * find entity other id and tenant id
     *
     * @param companyId   companyId
     * @param defaultFlag defaultFlag
     * @param tenantCode  tenantCode
     * @return account entity
     */
    Flux<Contacts> findByCompanyIdAndDefaultFlagAndTenantCode(Long companyId, Boolean defaultFlag, Long tenantCode);
}
